package com.yy.ui.controls
{
	import com.greensock.TweenLite;

	/**
	 *状态按钮 
	 * @author YY
	 * 
	 */
	public class StateButton extends Button
	{
		/**是否选中**/
		private var _select:Boolean = false;
		
		public var tween:Boolean = false;
		public function StateButton(skin:Object)
		{
			super(skin);
		}
		override protected function mouseOver():void{
			if (tween){
				TweenLite.to(super.background, 0.4, {
				scaleX:1.2,
				scaleY:1.2
				});
			};
		}
		override protected function mouseOut():void{
			if (enable && !_select){
				this.skinGotoAndStop(1);
			};
			if (tween){
				TweenLite.to(super.background, 0.4, {
					scaleX:1,
					scaleY:1
				});
			};
		}
		override protected function mouseDown():void{
			if (enable){
				_select = !_select;
				select = _select;
			};
		}
		override protected function mouseUp():void{
			
		}

		public function get select():Boolean
		{
			return _select;
		}

		/**
		 *设置选中状态 
		 * @param value
		 * 
		 */
		public function set select(value:Boolean):void
		{
			_select = value;
			if(_select) {
				this.skinGotoAndStop(3);
			}else {
				this.skinGotoAndStop(1);
			}
		}

	}
}